<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>


<body>
    <div id="test"></div>
</body>



<script type="text/javascript" src="../js/react.development.js"></script>
<script type="text/javascript" src="../js/react-dom.development.js"></script>
<script type="text/javascript" src="../js/babel.min.js"></script>
<script type="text/javascript" src="../js/prop-types.js"></script>

<script type="text/babel"> //必须声明 babel
    class Person extends React.Component {
        showData = () => {
            console.dir(this.refs.input1);
            const { input1 } = this
            alert(input1.value)
        }
        showdata2 = () => {
            const { input2 } = this
            alert(input2.value)
        }

        render() {
            return (
                <div>
                    <input type="text" plaseholder="请输入内容" ref={c => this.input1 = c} ></input>
                    <button onClick={this.showData}>点击弹窗</button>
                    // <input type="text" plaseholder="请输入内容" onBlur={this.showdata2} ref={c => this.input2 = c} ></input>
                </div>
            )
        }
    }
    ReactDOM.render(<Person />, document.getElementById('test'))
</script>

</html>